<template>
  <div>
    <!-- 顶部搜索 -->
    <div class="top">
      <div class="top_left">
        <van-icon name="map-marked" size="20px" />
        <span>定位</span>
      </div>
      <van-search v-model="value" left-icon="no" right-icon="search" />
      <div class="top_right">
        <van-icon name="enlarge" size="20px" style="marginTop:5px" />
        <p>扫一扫</p>
      </div>
    </div>

    <!-- 轮播图部分 -->
    <van-swipe :autoplay="3000" height="150">
      <van-swipe-item v-for="(image, index) in images" :key="index"
        ><img v-lazy="image"
      /></van-swipe-item>
    </van-swipe>
    <!-- tab组件部分 -->
    <van-tabs v-model="active">
      <van-tab title="全部">
        <div class="item">
          <div class="top">
            <div class="item_left">
              <span>招手绘漫画设计兼职</span>
              <div class="item_text">
                <p>四月五日前</p>
                <p>不设工作地点</p>
              </div>
            </div>
            <div class="item_right">
              <span>100/次</span>
              <div class="item_text">
                <van-icon name="browsing-history-o" style="float: left" />
                <p>42850</p>
                <p>千图广告</p>
              </div>
            </div>
          </div>
          <div class="bottom">
            <van-icon name="star-o" size="25px"/>
            <p style="fontSize:16px">收藏</p>
            <button>立即报名</button>
          </div>
        </div>
        <div class="item">
          <div class="top">
            <div class="item_left">
              <span>招手绘漫画设计兼职</span>
              <div class="item_text">
                <p>四月五日前</p>
                <p>不设工作地点</p>
              </div>
            </div>
            <div class="item_right">
              <span>100/次</span>
              <div class="item_text">
                <van-icon name="browsing-history-o" style="float: left" />
                <p>42850</p>
                <p>千图广告</p>
              </div>
            </div>
          </div>
          <div class="bottom">
            <van-icon name="star-o" size="25px"/>
            <p style="fontSize:16px">收藏</p>
            <button>立即报名</button>
          </div>
        </div>
        <div class="item">
          <div class="top">
            <div class="item_left">
              <span>招手绘漫画设计兼职</span>
              <div class="item_text">
                <p>四月五日前</p>
                <p>不设工作地点</p>
              </div>
            </div>
            <div class="item_right">
              <span>100/次</span>
              <div class="item_text">
                <van-icon name="browsing-history-o" style="float: left" />
                <p>42850</p>
                <p>千图广告</p>
              </div>
            </div>
          </div>
          <div class="bottom">
            <van-icon name="star-o" size="25px"/>
            <p style="fontSize:16px">收藏</p>
            <button>立即报名</button>
          </div>
        </div>
        
      </van-tab>
      <van-tab title="logo">内容 2</van-tab>
      <van-tab title="插画">内容 3</van-tab>
      <van-tab title="摄影">内容 4</van-tab>
    </van-tabs>
  </div>
</template>

<script>
import Vue from "vue";
import { Lazyload } from "vant";
Vue.use(Lazyload);
export default {
  data() {
    return {
      images: [
        "https://pic.rmb.bdstatic.com/bjh/f0c22c50c16003d69019bd356ffaa5ad.png",
        "https://pic.rmb.bdstatic.com/bjh/f0c22c50c16003d69019bd356ffaa5ad.png",
        "https://pic.rmb.bdstatic.com/bjh/f0c22c50c16003d69019bd356ffaa5ad.png",
        "https://pic.rmb.bdstatic.com/bjh/f0c22c50c16003d69019bd356ffaa5ad.png",
      ],
      value: "",
      index: "123",
      active: 0,
    };
  },
  methods: {
    onSearch(val) {
      Toast(val);
    },
    onCancel() {
      Toast("取消");
    },
  },
};
</script>

<style lang="less" scoped>
.van-search {
  width: 80%;
  input{
    border-radius: 20px;
  }
  .van-search__content{
    border-radius: 10px;
    background-color: #fff;
    box-shadow: 0px 1px 17px 5px #f2f0f0;
  }
}
.top {
  height: 80px;
  background-color: #fff;
  display: flex;
  justify-content: space-around;
  padding:10px 30px;
  .top_left {
    display: flex;
    align-items: center;
    flex-direction: column;
    justify-content: space-around;
  }
  .top_right {
    display: flex;
    align-items: center;
    flex-direction: column;
    justify-content: space-around;
  }
}
.van-swipe {
  img {
    width: 100%;
    height: 100%;
  }
}
.item {
  width: 90%;
  height: 220px;
  margin: 0 auto;
  background-color: #fff;
  border-radius: 10px;
  margin-top: 30px;
  padding: 20px;
  .top {
    display: flex;
    justify-content: space-between;
  }
  
  .item_left {
    span {
      font-size: 28px;
      font-weight: bold;
      color: #333;
    }
    p {
      font-size: 12px;
      color: #c7c4c4;
      margin-top: 3px;
    }
  }
  .item_text {
    margin-top: 30px;
  }
  .item_right {
    span {
      font-size: 28px;
      font-weight: bold;
      color: #d40606;
    }
    p {
      font-size: 12px;
      color: #c7c4c4;
      margin-top: 3px;
    }
  }
  .bottom{
    width: 300px;
    height: 50px;
    line-height: 50px;
    display: flex;
    float: right;
    margin-top: 60px;
    justify-content: space-around;
    button{
      width: 150px;
      height: 50px;
      line-height: 50px;
      background-color: #d40606;
      border: 0;
      color: #fff;
      border-radius: 10px;
    }
  }
}
</style>